package frobagroup.repositories.backstage;

import frobagroup.entities.backstage.Product;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;

import java.util.List;
import java.util.Set;

/**
 * Created by Tinsley on 2018/5/15.
 */
public interface ProductRepository extends MongoRepository<Product,String> {
    Page<Product> findByTypeAndStatus(String type, String status,Pageable pageable);
    List<Product> findByStatusAndIdIn(String status, Set<String> relatedProductsIds);
    Page<Product> findBySetTopTypeAndStatus(String setTopType,String status,Pageable pageable);
    List<Product> findByRelatedProductsIdsIn(Set<String> relatedProductsIds);
    Page<Product> findByTypeAndStatusAndProductNameLike(String type, String status,String productName,Pageable pageable);
    Page<Product> findByStatusAndProductNameLike(String status,String productName,Pageable pageable);
    Page<Product> findByStatusAndType(String status,String type,Pageable pageable);
    Page<Product> findByMustCheckOutAndStatus(boolean mustCheckOut,String status,Pageable pageable);
}
